package thread;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class Demo50 {
    public static void main(String[] args) throws IOException {
        try (InputStream inputStream = new FileInputStream("./test.txt")) {
            //一次读3个字节
            byte[] data = new byte[3];
            while (true) {
                int n = inputStream.read(data);
                if (n == -1) {
                    break;
                }
                for (int i = 0; i < n; i++) {
                    System.out.printf("0x%x\n", data[i]);
                }
                System.out.println("======================");
            }
        }
    }
}
